﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EZCRS.HCMS.Entity;
using EZCRS.HCMS.SqlClient;
using System.Collections;

namespace EZCRS.HCMS.Bll.baseinfo
{
    public class BllFacility
    {
        public List<HCRS_Facilityclass> getfclass()
        {
            return new sql_hcrs_facility().getallfclass();
        }

        public List<HCRS_Facility> getf(int ltype,string nkey)
        {
            return new sql_hcrs_facility().getallfacility(ltype,CFun.VerifySQL(nkey));
        }

        public bool delfacility(int id)
        {
            return new sql_hcrs_facility().delfacility(id);
        }

        public string gethotelfacility(int pid)
        {
            HCRS_Description _des = new sql_hcrs_description().getitem(pid, 2);
            if (_des != null)
            {
                return _des.Facilities;
            }
            else
                return "";
        }

        public bool insertorupdate(HCRS_Facility _f)
        {
            return new sql_hcrs_facility().insertorupdate(_f);
        }

        public bool savehotelfacility(int pid, string facilities)
        {
            return new sql_hcrs_description().modifyfacility(pid, facilities);
        }

        public ArrayList gethotelother(int pid)
        {
            ArrayList list = new ArrayList();
            HCRS_Description _des = new sql_hcrs_description().getitem(pid, 2);
            if (_des != null)
            {
                list.Add(_des.Meetings);
                list.Add(_des.Dining);
                list.Add(_des.Transportation);
                list.Add(_des.Recreation);
                list.Add("");
                list.Add("");
                return list;

            }
            else
            {
                list.Add("");
                list.Add("");
                list.Add("");
                list.Add("");
                list.Add("");
                list.Add("");
                return list;
            }
        }

        public bool savehotelother(int pid,string[] lists)
        {
            return new sql_hcrs_description().modifyotherinfo(pid.ToString(), lists[0], lists[1], lists[2], lists[3], lists[4], lists[5]);
        }

        public ArrayList getaddition(int pid)
        {
            ArrayList list = new ArrayList();
            HCRS_Description _des = new sql_hcrs_description().getitem(pid, 2);
            if (_des != null)
            {
                list.Add(_des.team);
                list.Add(_des.market);
                return list;
            }
            else
                return null;
        }

        public bool saveaddition(int pid, string team, string market)
        {
            return new sql_hcrs_description().modifyaddition(pid, team, market);
        }
    }
}
